package com.moonciki.artadmin.web.service.hello.impl;

import com.moonciki.artadmin.core.model.PageParameter;
import com.moonciki.artadmin.core.tools.CustomPageHelper;
import com.moonciki.artadmin.core.utils.DateUtil;
import com.moonciki.artadmin.core.base.BaseServiceImpl;
import com.moonciki.artadmin.web.service.hello.HelloWorldService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @author 岳仕奇
 * @description: hello
 * @date 2021/10/19 11:52
 */
@Slf4j
@Service
public class HelloWorldServiceImpl extends BaseServiceImpl implements HelloWorldService {

    @Override
    public void helloWorld(PageParameter pageParameter) {
        CustomPageHelper sqlPager = pageParameter.createSqlPager();
        sqlPager.startPagger();

        sqlPager.endPagger(null);

        //PageData<UserInfo> pageData = sqlPager.getPageData();

        log.info("hello world!");

    }

    @Cacheable(cacheNames="cacheTest#70", key= "'book-' + #key")
    @Override
    public String cacheTest(String key) {

        String nowTimeStr = DateUtil.getNowTime(DateUtil.date_time_format);

        return nowTimeStr;
    }
}
